package com.mnb.base.service.impl;

import com.mnb.base.entity.StRvfcchB;
import com.mnb.base.mapper.StRvfcchBMapper;
import com.mnb.common.utils.R;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.mnb.base.entity.StRvfcchB;
import com.mnb.base.mapper.StRvfcchBMapper;
import com.mnb.base.service.StRvfcchBService;

import java.util.List;

@Service
public class StRvfcchBServiceImpl implements StRvfcchBService{

    @Resource
    private StRvfcchBMapper stRvfcchBMapper;


    @Override
    public int deleteByPrimaryKey(String stcd) {
        return stRvfcchBMapper.deleteByPrimaryKey(stcd);
    }

    @Override
    public R getList(StRvfcchB stRvfcchB) {
        List<StRvfcchB> list =  stRvfcchBMapper.getList(stRvfcchB);
        return R.ok(list);
    }

    @Override
    public R insert(StRvfcchB stRvfcchB) {
        StRvfcchB count = stRvfcchBMapper.selectByPrimaryKey(stRvfcchB.getStcd());
        if(count != null){
            return R.fail("该信息已存在");
        }
        stRvfcchBMapper.insert(stRvfcchB);
        return R.ok();
    }

    @Override
    public R udpate(StRvfcchB stRvfcchB) {
        stRvfcchBMapper.updateByPrimaryKey(stRvfcchB);
        return R.ok();
    }


}
